﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using TestProjectController;

namespace TestProject.Editor
{
    public partial class Articles : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var articlesController = new ArticlesController();
            dataRepeater.DataSource = articlesController.GetAuthorArticles(User.Identity.Name);
            dataRepeater.DataBind();
        }

        protected void DeleteArticle(object sender, EventArgs e)
        {
            
        }

        protected void dataRepeater_ItemCommand(Object sender, RepeaterCommandEventArgs e)
        {
            if(e.CommandName == "Delete")
            {
                var articleController = new TestProjectController.ArticlesController();

                articleController.DeleteArticle(Convert.ToInt32(e.CommandArgument.ToString()));
            }

            dataRepeater.DataBind();
        }
    }
}